import 'package:elephant_fish/model/user_info_entity.dart';
import 'package:elephant_fish/page/setting_black_list_page.dart';
import 'package:elephant_fish/page/setting_help_page.dart';
import 'package:elephant_fish/page/setting_order_page.dart';
import 'package:elephant_fish/page/setting_privacy_page.dart';
import 'package:elephant_fish/util/size_util.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class SettingPage extends StatefulWidget {
  final UserInfoEntity userInfoEntity;
  const SettingPage({Key key, this.userInfoEntity}) : super(key: key);

  @override
  _SettingPageState createState() => _SettingPageState();
}

class _SettingPageState extends State<SettingPage> {
  bool _switchValue = false;
  bool _switchValueEffect = false;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Color(0xff140c3d),
      appBar: AppBar(
        backgroundColor: Color(0xff140c3d),
        centerTitle: true,
        leading: GestureDetector(
          child: Icon(
            Icons.arrow_back_ios,
            size: SizeUtil.px(32),
            color: Color(0xfff3f3f3),
          ),
          onTap: () {
            Navigator.pop(context);
          },
        ),
        title: Text(
          '设置',
          style: TextStyle(fontSize: SizeUtil.px(32), color: Color(0xfff5f5f5)),
        ),
      ),
      body:SingleChildScrollView(
        child: Padding(
          padding: EdgeInsets.only(top: SizeUtil.px(28) ),
          child: Align(
            alignment: Alignment.topCenter,
            child: Container(
              width: SizeUtil.px(710),
              decoration: BoxDecoration(
                color: Color(0xff2b244d),
                borderRadius: BorderRadius.all(Radius.circular(SizeUtil.px(20))),
              ),
              child: Column(
                children: [
                  SizedBox(height: SizeUtil.px(26),),
                  InkWell(
                    child: Row(
                      children: [
                        Padding(padding: EdgeInsets.only(left: SizeUtil.px(24)),
                          child: Image.asset('assets/images/setting_privacy.png',width: SizeUtil.px(59),),
                        ),
                        Padding(padding: EdgeInsets.only(left: SizeUtil.px(16)),
                          child:  Text('隐私',style: TextStyle(fontSize: SizeUtil.px(29),color: Color(0xfff3f3f3)),),
                        ),
                      ],
                    ),
                    onTap: (){
                      Navigator.of(context).push( MaterialPageRoute(builder: (context)=>SettingPrivacyPage()));
                    },
                  ),
                  SizedBox(height: SizeUtil.px(51),),
                  InkWell(
                    child: Row(
                      children: [
                        Padding(padding: EdgeInsets.only(left: SizeUtil.px(24)),
                          child: Image.asset('assets/images/setting_blacklist.png',width: SizeUtil.px(59),),
                        ),
                        Padding(padding: EdgeInsets.only(left: SizeUtil.px(16)),
                          child:  Text('黑名单',style: TextStyle(fontSize: SizeUtil.px(29),color: Color(0xfff3f3f3)),),
                        ),
                      ],
                    ),
                    onTap: (){
                      Navigator.of(context).push( MaterialPageRoute(builder: (context)=>SettingBlackListPage()));
                    },
                  ),
                  SizedBox(height: SizeUtil.px(51),),
                  InkWell(
                    child: Row(
                      children: [
                        Padding(padding: EdgeInsets.only(left: SizeUtil.px(24)),
                          child: Image.asset('assets/images/setting_help.png',width: SizeUtil.px(59),),
                        ),
                        Padding(padding: EdgeInsets.only(left: SizeUtil.px(16)),
                          child:  Text('帮助反馈',style: TextStyle(fontSize: SizeUtil.px(29),color: Color(0xfff3f3f3)),),
                        ),
                      ],
                    ),
                    onTap: (){
                      Navigator.of(context).push( MaterialPageRoute(builder: (context)=>SettingHelpPage()));
                    },
                  ),
                  SizedBox(height: SizeUtil.px(51),),
                 Stack(
                      children: [
                        Padding(padding: EdgeInsets.only(left: SizeUtil.px(24)),
                          child: Image.asset('assets/images/setting_notice.png',width: SizeUtil.px(59),),
                        ),

                        Padding(padding: EdgeInsets.only(left: SizeUtil.px(99),top: SizeUtil.px(9)),
                          child:  Text('开播通知开关',style: TextStyle(fontSize: SizeUtil.px(29),color: Color(0xfff3f3f3)),),
                        ),
                        Align(
                          alignment: Alignment.centerRight,
                          child: Padding(padding: EdgeInsets.only(right: SizeUtil.px(26)),
                            child: CupertinoSwitch(
                              activeColor: Color(0xfff1f1f1),
                              trackColor: Color(0xfff1f1f1),
                              value: _switchValueEffect,
                              // 点击或者拖拽事件
                              onChanged: (value){
                                _switchValueEffect = value;
                                setState(() {
                                });
                              },
                            ),
                          ),
                        )

                      ],
                    ),
                  SizedBox(height: SizeUtil.px(51),),
                  Stack(
                    children: [
                      Padding(padding: EdgeInsets.only(left: SizeUtil.px(24)),
                        child: Image.asset('assets/images/setting_effect.png',width: SizeUtil.px(59),),
                      ),

                      Padding(padding: EdgeInsets.only(left: SizeUtil.px(99),top: SizeUtil.px(9)),
                        child:  Text('特效开关',style: TextStyle(fontSize: SizeUtil.px(29),color: Color(0xfff3f3f3)),),
                      ),
                      Align(
                        alignment: Alignment.centerRight,
                        child: Padding(padding: EdgeInsets.only(right: SizeUtil.px(26)),
                          child: CupertinoSwitch(
                            activeColor: Color(0xfff1f1f1),
                            trackColor: Color(0xfff1f1f1),
                            value: _switchValue,
                            // 点击或者拖拽事件
                            onChanged: (value){
                              _switchValue = value;
                              setState(() {
                              });
                            },
                          ),
                        ),
                      )

                    ],
                  ),
                  SizedBox(height: SizeUtil.px(51),),
                  InkWell(
                    child: Row(
                      children: [
                        Padding(padding: EdgeInsets.only(left: SizeUtil.px(24)),
                          child: Image.asset('assets/images/setting_beauty.png',width: SizeUtil.px(59),),
                        ),
                        Padding(padding: EdgeInsets.only(left: SizeUtil.px(16)),
                          child:  Text('开启美颜',style: TextStyle(fontSize: SizeUtil.px(29),color: Color(0xfff3f3f3)),),
                        ),
                      ],
                    ),
                    onTap: (){
                      print('开启美颜');
                    },
                  ),
                  SizedBox(height: SizeUtil.px(51),),
                  InkWell(
                    child: Row(
                      children: [
                        Padding(padding: EdgeInsets.only(left: SizeUtil.px(24)),
                          child: Image.asset('assets/images/setting_order.png',width: SizeUtil.px(59),),
                        ),
                        Padding(padding: EdgeInsets.only(left: SizeUtil.px(16)),
                          child:  Text('订单',style: TextStyle(fontSize: SizeUtil.px(29),color: Color(0xfff3f3f3)),),
                        ),

                      ],
                    ),
                    onTap: (){
                      Navigator.of(context).push( MaterialPageRoute(builder: (context)=>SettingOrderPage()));
                    },
                  ),
                  SizedBox(height: SizeUtil.px(51),),
                  InkWell(
                    child: Row(
                      children: [
                        Padding(padding: EdgeInsets.only(left: SizeUtil.px(24)),
                          child: Image.asset('assets/images/setting_custom_service.png',width: SizeUtil.px(59),),
                        ),
                        Padding(padding: EdgeInsets.only(left: SizeUtil.px(16)),
                          child:  Text('客服',style: TextStyle(fontSize: SizeUtil.px(29),color: Color(0xfff3f3f3)),),
                        ),

                      ],
                    ),
                    onTap: (){
                      print('客服');
                    },
                  ),
                  SizedBox(height: SizeUtil.px(20),),
                ],
              ),
            ),
          ),
        ),
      )
    );
  }
}
